/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package goodenglish.interfaces.videoplay;

import javafx.util.Duration;

/**
 *
 * @author 关攀攀 panpan_001@126.com
 */
public class DurationTime {

    private Duration duration;
    public int hours;
    public int minutes;
    public int seconds;

    public DurationTime(Duration duration) {
        this.duration = duration;
        int intElapsed = (int) Math.floor(duration.toSeconds());
        //把秒转换为小时
        hours = intElapsed / (60 * 60);

        //如果片长大于一小时，则减去小时时间
        if (hours > 0) {
            intElapsed -= hours * 60 * 60;
        }

        //计算减去小时后的分钟数
        minutes = intElapsed / 60;
        //计算剩下的秒数
        seconds = intElapsed - hours * 60 * 60 - minutes * 60;
    }
    
    
}
